//package com.bd.schedule.config;
//
//import org.quartz.Scheduler;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
//
//import java.io.IOException;
//
//@Configuration
//public class QuartzConfig {
//
//    @Autowired
//    private JobFactory jobFactory;
//
//    public QuartzConfig(JobFactory jobFactory){
//        this.jobFactory = jobFactory;
//    }
//
//    @Bean
//    public SchedulerFactoryBean schedulerFactoryBean() throws IOException {
//        SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
//        schedulerFactoryBean.setOverwriteExistingJobs(true);
//
//        schedulerFactoryBean.setQuartzProperties(quartzProperties());
//        if (!this.properties.getProperties().isEmpty()) {
//            //  将所有properties设置到QuartzProperties
//            schedulerFactoryBean.setQuartzProperties(this.asProperties(this.properties.getProperties()));
//        }
//        schedulerFactoryBean.setJobFactory(jobFactory);
//        return schedulerFactoryBean;
//    }
//
//    @Bean(name = "scheduler")
//    public Scheduler scheduler() throws IOException {
//        return schedulerFactoryBean().getScheduler();
//    }
//}
